import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import store  from '../store/index.js'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue')
  },
  {
    path: '/list',
    name: 'List',
    component: () => import('../views/List.vue')
  },
  {
    path: '/mine',
    name: 'Mine',
    component: () => import('../views/Mine.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: "/setting",
    name: "Setting",
    component: () => import('../views/Setting.vue')
  },
  {
    path: "/detail",
    name: "Detail",
    component: () => import('../views/Detail.vue')
  },
  {
    path: "/search",
    name: "Search",
    component: () => import('../views/Search.vue')
  },
  {
    path: "/searchlist",
    name: "SearchList",
    component: () => import('../views/SearchList.vue')
  },
  {
    path: "/addresslist",
    name: "addressList",
    component: () => import('../views/addressList.vue')
  },
  {
    path: "/editoraddress",
    name: "editorAddress",
    component: () => import('../views/EditorAddress.vue')
  }
]

const router = new VueRouter({
  routes
})

router.beforeEach((to,from,next)=>{
	store.commit("showRuter",to.path)
	next()
})

export default router